import type { ResponseData } from './request';

export interface AppMenuInterface {
  [key: string]: MenuInterface;
}

export interface MenuInterface {
  hospitalCode: string;
  areaCode: string;
  areaName: string;
  orgId: string;
  orgCode: string;
  orgName: string;
  functions: FunctionsInterface[];
  shortcutMenu?: FunctionsInterface[];
  normalMenu?: FunctionsInterface[];
}

export interface FunctionsInterface {
  id: string;
  parentId: string;
  sysCode?: string;
  systemId: string;
  funcType: string;
  funcCode?: string;
  funcName: string;
  funcHome: string;
  funcParam: string;
  enableFlag: string;
  pyCode?: string;
  wbCode?: string;
  funcIcon?: string;
  funcPath?: string;
  children: FunctionsInterface[];
}

export const menuApi = (): Promise<ResponseData<MenuInterface>> =>
  request<ResponseData<MenuInterface>, null>('/login/userFunctions', 'get');
